import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    meta:{title:"地图",icon: '20' },
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/pages/dashboard/index'),
      meta: { title: '地图' }
    }]
  },
  {
    path: '/application',
    component: Layout,
    meta:{title:"应用管理",icon: '21' },
    children: [
      {
        path: 'index',
        name: 'application',
        component: () => import('@/pages/application/Application'),
        meta: { title: '应用管理'}
      },
      
      {
        path: 'create',
        hidden:true,
        name: 'application_create',
        component: () => import('@/pages/application/Applicationcreate'),
        meta: { title: '应用创建' }
      }

    ]
  },
  {
    path: '/recognition',
    component: Layout,
    meta: { title: '图像识别', icon: '12' },
    children: [
      {
        path: 'index',
        name: 'recognition',
        component: () => import('@/pages/recognition/index'),
        meta: { title: '图像识别' }
      }
    ]
  },
  // {
  //   path: '/article',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'article',
  //       component: () => import('@/pages/article/article'),
  //       meta: { title: '文章管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'article_create',
  //       component: () => import('@/pages/article/articlecreate'),
  //       meta: { title: '文章创建', icon: 'nested' }
  //     }

  //   ]
  // },
  {
    path: '/category',
    component: Layout,
  
    children: [
      {
        path: 'index',
        name: 'category',
        component: () => import('@/pages/category/category'),
        meta: { title: '分类管理',icon:'17'}
      },
      {
        path: 'create',
        hidden:true,
        name: 'category_create',
        component: () => import('@/pages/category/categorycreate'),
        meta: { title: '分类创建' }
      }
    ]
  },
  // {
  //   path: '/BaseConfig',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'BaseConfig_create',
  //       component: () => import('@/pages/BaseConfig/BaseConfig'),
  //       meta: { title: '数据字典管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'category_create',
  //       component: () => import('@/pages/BaseConfig/BaseConfigcreate'),
  //       meta: { title: '数据字典创建', icon: 'nested' }
  //     }
      
  //   ]
  // },
  {
    path: '/BaseFile',
    component: Layout,
    meta: { title: '文件消息' ,icon:'s'},
    children: [
      {
        path: 'index',
        name: 'BaseFile',
        component: () => import('@/pages/BaseFile/BaseFile'),
        meta: { title: '文件管理',icon:'2' }
      },
      {
        path: 'create',
        hidden:true,
        name: 'BaseFile_create',
        component: () => import('@/pages/BaseFile/BaseFilecreate'),
        meta: { title: '文件创建' }
      },
      {
              path: 'BaseLog',
              name: 'BaseLog',
              component: () => import('@/pages/BaseLog/BaseLog'),
              meta: { title: '日志管理' ,icon:'4'}
            },
            {
              path: 'BaseLog_create',
              hidden:true,
              name: 'BaseLog_create',
              component: () => import('@/pages/BaseLog/BaseLogcreate'),
              meta: { title: '日志创建' }
            },
            {
                path: 'Counsel',
                name: 'Counsel',
                component: () => import('@/pages/Counsel/Counsel'),
                meta: { title: '消息管理',icon:'5' }
              },
              {
                path: 'Counsel_create',
                hidden:true,
                name: 'Counsel_create',
                component: () => import('@/pages/Counsel/Counselcreate'),
                meta: { title: '消息创建' }
              },
              {
                      path: 'Comment',
                      name: 'Comment',
                      component: () => import('@/pages/Comment/Comment'),
                      meta: { title: '评论管理' ,icon:'6'}
                    },
                    {
                      path: 'Comment_create',
                      hidden:true,
                      name: 'Comment_create',
                      component: () => import('@/pages/Comment/Commentcreate'),
                      meta: { title: '评论创建' }
                    },
                    {
                            path: 'article',
                            name: 'article',
                            component: () => import('@/pages/article/article'),
                            meta: { title: '文章管理' ,icon:'7'}
                          },
                          {
                            path: 'article_create',
                            hidden:true,
                            name: 'article_create',
                            component: () => import('@/pages/article/articlecreate'),
                            meta: { title: '文章创建' }
                          }
    ]
  },
  // {
  //   path: '/BaseLog',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'BaseLog',
  //       component: () => import('@/pages/BaseLog/BaseLog'),
  //       meta: { title: '日志管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'BaseLog_create',
  //       component: () => import('@/pages/BaseLog/BaseLogcreate'),
  //       meta: { title: '日志创建', icon: 'nested' }
  //     }
  //   ]
  // },
  // {
  //   path: '/BasePrivilege',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'BasePrivilege',
  //       component: () => import('@/pages/BasePrivilege/BasePrivilege'),
  //       meta: { title: '权限管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'BasePrivilege_create',
  //       component: () => import('@/pages/BasePrivilege/BasePrivilegecreate'),
  //       meta: { title: '权限创建', icon: 'nested' }
  //     }
  //   ]
  // },
  {
    path: '/BaseRole',
    component: Layout,
    meta: { title: '角色账户' ,icon:'8'},
    children: [
      {
        path: 'index',
        name: 'BaseRole',
        component: () => import('@/pages/BaseRole/BaseRole'),
        meta: { title: '角色管理',icon:'8' }
      },
      {
        path: 'create',
        hidden:true,
        name: 'BaseRole_create',
        component: () => import('@/pages/BaseRole/BaseRolecreate'),
        meta: { title: '角色创建' }
      },
      {
              path: 'BaseRolePrivilege',
              name: 'BaseRolePrivilege',
              component: () => import('@/pages/BaseRolePrivilege/BaseRolePrivilege'),
              meta: { title: '基本角色特权管理',icon:'9'}
            },
            {
              path: 'BaseRolePrivilege_create',
              hidden:true,
              name: 'BaseRolePrivilege_create',
              component: () => import('@/pages/BaseRolePrivilege/BaseRolePrivilegecreate'),
              meta: { title: '基本角色特权创建' }
            },
            {
                    path: 'BaseUser',
                    name: 'BaseUser',
                    component: () => import('@/pages/BaseUser/BaseUser'),
                    meta: { title: '账户管理',icon:'10' }
                  },
                  {
                    path: 'BaseUser_create',
                    hidden:true,
                    name: 'BaseUser_create',
                    component: () => import('@/pages/BaseUser/BaseUsercreate'),
                    meta: { title: '账户创建' }
                  },
                  {
                    path: 'BaseUser_introduce',
                    hidden:true,
                    name: 'BaseUser_introduce',
                    component: () => import('@/pages/BaseUser/BaseUserintroduce'),
                    meta: { title: '用户介绍',icon:'12' }
                  },
                  {
                          path: 'BaseUserRole',
                          name: '/BaseUserRole',
                          component: () => import('@/pages/BaseUserRole/BaseUserRole'),
                          meta: { title: '用户角色连接管理',icon:'13' }
                        },
                        {
                          path: 'BaseUserRole_create',
                          hidden:true,
                          name: 'BaseUserRole_create',
                          component: () => import('@/pages/BaseUserRole/BaseUserRolecreate'),
                          meta: { title: '用户角色连接创建' }
                        },
                        {
                          path: 'BasePrivilege',
                          name: 'BasePrivilege',
                          component: () => import('@/pages/BasePrivilege/BasePrivilege'),
                          meta: { title: '权限管理' ,icon:'14'}
                        },
                        {
                          path: 'BasePrivilege_create',
                          hidden:true,
                          name: 'BasePrivilege_create',
                          component: () => import('@/pages/BasePrivilege/BasePrivilegecreate'),
                          meta: { title: '权限创建' }
                        }

    ]
  },
  // {
  //   path: '/BaseRolePrivilege',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'BaseRolePrivilege',
  //       component: () => import('@/pages/BaseRolePrivilege/BaseRolePrivilege'),
  //       meta: { title: '基本角色特权管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'BaseRolePrivilege_create',
  //       component: () => import('@/pages/BaseRolePrivilege/BaseRolePrivilegecreate'),
  //       meta: { title: '基本角色特权创建', icon: 'nested' }
  //     }
  //   ]
  // },
  // {
  //   path: '/BaseUser',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'BaseUser',
  //       component: () => import('@/pages/BaseUser/BaseUser'),
  //       meta: { title: '账户管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'BaseUser_create',
  //       component: () => import('@/pages/BaseUser/BaseUsercreate'),
  //       meta: { title: '账户创建', icon: 'nested' }
  //     },
  //     {
  //       path: 'introduce',
  //       hidden:true,
  //       name: 'BaseUser_introduce',
  //       component: () => import('@/pages/BaseUser/BaseUserintroduce'),
  //       meta: { title: '用户介绍', icon: 'nested' }
  //     }
  //   ]
  // },
  // {
  //   path: '/BaseUserRole',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: '/BaseUserRole',
  //       component: () => import('@/pages/BaseUserRole/BaseUserRole'),
  //       meta: { title: '用户角色连接管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'BaseUserRole_create',
  //       component: () => import('@/pages/BaseUserRole/BaseUserRolecreate'),
  //       meta: { title: '用户角色连接创建', icon: 'nested' }
  //     }
  //   ]
  // },
  // {
  //   path: '/Comment',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'Comment',
  //       component: () => import('@/pages/Comment/Comment'),
  //       meta: { title: '评论管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'Comment_create',
  //       component: () => import('@/pages/Comment/Commentcreate'),
  //       meta: { title: '评论创建', icon: 'nested' }
  //     }
  //   ]
  // },
  // {
  //   path: '/Counsel',
  //   component: Layout,
  //   children: [
  //     // {
  //     //   path: 'index',
  //     //   name: 'Counsel',
  //     //   component: () => import('@/pages/Counsel/Counsel'),
  //     //   meta: { title: '消息管理', icon: 'table' }
  //     // },
  //     // {
  //     //   path: 'create',
  //     //   hidden:true,
  //     //   name: 'Counsel_create',
  //     //   component: () => import('@/pages/Counsel/Counselcreate'),
  //     //   meta: { title: '消息创建', icon: 'nested' }
  //     // }
  //   ]
  // },
  {
    path: '/Dateset',
    component: Layout,
    meta: { title: '数据集', icon: '15' },
    children: [
      {
        path: 'index',
        name: 'Dateset',
        component: () => import('@/pages/Dateset/Dateset'),
        meta: { title: '数据集管理', icon: '15'}
      },
      {
        path: 'create',
        hidden:true,
        name: 'Dataset_create',
        component: () => import('@/pages/Dateset/Datesetcreate'),
        meta: { title: '数据集创建' }
      },
      {
              path: 'DatasetFile',
              name: 'DatasetFile',
              component: () => import('@/pages/DatasetFile/DatasetFile'),
              meta: { title: '训练数据管理',icon:'16' }
            },
            {
              path: 'DatasetFile_create',
              hidden:true,
              name: 'DatasetFile_create',
              component: () => import('@/pages/DatasetFile/DatasetFilecreate'),
              meta: { title: '训练数据创建' }
            },
            {
              path: 'BaseConfig',
              name: 'BaseConfig',
              component: () => import('@/pages/BaseConfig/BaseConfig'),
              meta: { title: '数据字典管理' ,icon:'17'}
            },
            {
              path: 'BaseConfig_create',
              hidden:true,
              name: 'BaseConfig_create',
              component: () => import('@/pages/BaseConfig/BaseConfigcreate'),
              meta: { title: '数据字典创建' }
            }
            

    ]
  },
  // {
  //   path: '/DatesetFile',
  //   component: Layout,
  //   meta:{title:"训练数据",icon: 'nested' },
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'DatesetFile',
  //       component: () => import('@/pages/DatesetFile/DatesetFile'),
  //       meta: { title: '训练数据管理' }
  //     },
  //     {
  //       path: 'dataset_file',
  //       hidden:true,
  //       name: 'DatesetFile_create',
  //       component: () => import('@/pages/DatesetFile/DatesetFilecreate'),
  //       meta: { title: '训练数据创建' }
  //     }
  //   ]
  // },
  // {
  //   path: '/Greenhouse',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'Greenhouse',
  //       component: () => import('@/pages/Greenhouse/Greenhouse'),
  //       meta: { title: '室温管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'Greenhouse_create',
  //       component: () => import('@/pages/Greenhouse/Greenhousecreate'),
  //       meta: { title: '室温创建', icon: 'nested' }
  //     }
  //   ]
  // },
  {
    path: '/Interfaces',
    component: Layout,
    meta: { title: '其他模块',icon:'18' },
    children: [
      {
        path: 'index',
        name: 'Interfaces',
        component: () => import('@/pages/Interfaces/Interfaces'),
        meta: { title: '接口管理',icon:'18' }
      },
      {
        path: 'create',
        hidden:true,
        name: 'Interfaces_create',
        component: () => import('@/pages/Interfaces/Interfacescreate'),
        meta: { title: '接口创建' }
      },
      {
              path: 'Moudle',
              name: 'Moudle',
              component: () => import('@/pages/Moudle/Moudle'),
              meta: { title: '模块管理' ,icon:'19'}
            },
            {
              path: 'Moudle_create',
              hidden:true,
              name: 'Moudle_create',
              component: () => import('@/pages/Moudle/Moudlecreate'),
              meta: { title: '模块创建' }
            },
            {
              path: 'Greenhouse',
              name: 'Greenhouse',
              component: () => import('@/pages/Greenhouse/Greenhouse'),
              meta: { title: '室温管理' ,icon:'20'}
            },
            {
              path: 'Greenhouse_create',
              hidden:true,
              name: 'Greenhouse_create',
              component: () => import('@/pages/Greenhouse/Greenhousecreate'),
              meta: { title: '室温创建' }
            }

    ]
  },
  // {
  //   path: '/Moudle',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'Moudle',
  //       component: () => import('@/pages/Moudle/Moudle'),
  //       meta: { title: '模块管理', icon: 'table' }
  //     },
  //     {
  //       path: 'create',
  //       hidden:true,
  //       name: 'Moudle_create',
  //       component: () => import('@/pages/Moudle/Moudlecreate'),
  //       meta: { title: '模块创建', icon: 'nested' }
  //     }
  //   ]
  // },

  // {
  //   path: '/form',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'Form',
  //       component: () => import('@/pages/test/index'),
  //       meta: { title: '测试模块', icon: 'form' }
  //     }
  //   ]
  // },
 

  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
